<?php
// No directAcces
defined( '_AppBackMiage' ) or die( 'Restricted access' );
if(isAdministrateur ()){
    include_once (DS."backoffice/include/header.php");
    if(isset($_GET['uid']) && !empty($_GET['uid']))
    {
        $categorie = new Categorie($_GET['uid']);
    }
    else
    {
        redirectTo(URLBACK."_portailcategorie_list");
    }

    if(isset($_POST['modifier']) && !empty($_POST['modifier'])){
            if(isset($_POST['nom']) && !empty($_POST['nom']) && isset($_POST['desc']) && !empty($_POST['desc'])){
                    $categorie->setNomCategorie($_POST['nom']);
                    $categorie->setDescriptionCategorie($_POST['desc']);
                    $categorie->save();
            }
    }

    include_once( DS."backoffice/include/toppanel_portail.php");
    ?>
    <div id="wrapper">
            <div id="content">
            <div id="box">
                <h3 id="adduser">Edition d'une cat&eacute;gorie</h3>
                            <?php
                $listeCategorie = Categorie::getListCategory();
                foreach($listeCategorie as $categorie){
                    if($categorie->IdCategorie == $_GET['uid']){
                        ?>
                        <form id="form" method="post">
                            <fieldset id="personal"><legend>Modification de la Cat&eacute;gorie</legend>
                                <p><label for="nom">Cat&eacute;gorie:</label><input type="text" id="nom" name="nom" value=<?php echo $categorie->NomCategorie;?>  tabindex="1" /></p>
                                <p><label for="desc">Description:</label><input type="text" id="desc" name="desc" value="<?php echo $categorie->DescriptionCategorie;?>"  tabindex="2" /></p>
                            </fieldset>
                            <div align="center">
                                    <input id="button1"type="submit" name="modifier" value="Modifier" />
                                            <input id="button2" type="reset" />
                            </div>
                        </form>
                        <?php
                    }
                }
                ?>
            </div>
           </div>

    <?php
    include_once (DS."backoffice/include/sidebar.php");
    include_once (DS."backoffice/include/footer.php");
}
else
{
    redirectTo(URLBACK);
}
?>